import imdlib as imd
import numpy as np
import matplotlib.pyplot as plt
Matplotlib is building the font cache; this may take a moment.
start_yr=1951
end_yr=1960
variable='tmax'
data=imd.get_data(variable, start_yr, end_yr, fn_format="yearwise")
Downloading: maxtemp for year 1951 Downloading: maxtemp for year 1952 Downloading: maxtemp for year 1953 Downloading: maxtemp for year 1954 Downloading: maxtemp for year 1955 Downloading: maxtemp for year 1956 Downloading: maxtemp for year 1957 Downloading: maxtemp for year 1958 Downloading: maxtemp for year 1959 Downloading: maxtemp for year 1960 Download Successful !!!
ds=data.get_xarray()
ds_time_series = ds.sel(lat=np.arange(18.75,19.25,0.25), lon=np.arange(72.50, 73.00,0.25),method= "nearest")
ds_time_series=ds_time_series['tmax'].mean(dim=('lat','lon'))
ds_time_series.plot(color="purple", aspect = 7, size = 8)
plt.savefig('Series_decade_1_tmax.png', bbox_inches='tight')
start_yr=1961
end_yr=1970
variable='tmax'
data1=imd.get_data(variable, start_yr, end_yr, fn_format="yearwise")
Downloading: maxtemp for year 1961 Downloading: maxtemp for year 1962 Downloading: maxtemp for year 1963 Downloading: maxtemp for year 1964 Downloading: maxtemp for year 1965 Downloading: maxtemp for year 1966 Downloading: maxtemp for year 1967 Downloading: maxtemp for year 1968 Downloading: maxtemp for year 1969 Downloading: maxtemp for year 1970 Download Successful !!!
ds=data1.get_xarray()
ds_time_series = ds.sel(lat=np.arange(18.75,19.25,0.25), lon=np.arange(72.50, 73.00,0.25),method= "nearest")
ds_time_series=ds_time_series['tmax'].mean(dim=('lat','lon'))
ds_time_series.plot(color="purple", aspect = 7, size = 8)
plt.savefig('Series_decade_2_tmax.png', bbox_inches='tight')
start_yr=1971
end_yr=1980
variable='tmax'
data2=imd.get_data(variable, start_yr, end_yr, fn_format="yearwise")
Downloading: maxtemp for year 1971 Downloading: maxtemp for year 1972 Downloading: maxtemp for year 1973 Downloading: maxtemp for year 1974 Downloading: maxtemp for year 1975 Downloading: maxtemp for year 1976 Downloading: maxtemp for year 1977 Downloading: maxtemp for year 1978 Downloading: maxtemp for year 1979 Downloading: maxtemp for year 1980 Download Successful !!!
ds=data2.get_xarray()
ds_time_series = ds.sel(lat=np.arange(18.75,19.25,0.25), lon=np.arange(72.50, 73.00,0.25),method= "nearest")
ds_time_series=ds_time_series['tmax'].mean(dim=('lat','lon'))
ds_time_series.plot(color="purple", aspect = 7, size = 8)
plt.savefig('Series_decade_3_tmax.png', bbox_inches='tight')
start_yr=1981
end_yr=1990
variable='tmax'
data3=imd.get_data(variable, start_yr, end_yr, fn_format="yearwise")
Downloading: maxtemp for year 1981 Downloading: maxtemp for year 1982 Downloading: maxtemp for year 1983 Downloading: maxtemp for year 1984 Downloading: maxtemp for year 1985 Downloading: maxtemp for year 1986 Downloading: maxtemp for year 1987 Downloading: maxtemp for year 1988 Downloading: maxtemp for year 1989 Downloading: maxtemp for year 1990 Download Successful !!!
ds=data3.get_xarray()
ds_time_series = ds.sel(lat=np.arange(18.75,19.25,0.25), lon=np.arange(72.50, 73.00,0.25),method= "nearest")
ds_time_series=ds_time_series['tmax'].mean(dim=('lat','lon'))
ds_time_series.plot(color="purple", aspect = 7, size = 8)
plt.savefig('Series_decade_4_tmax.png', bbox_inches='tight')
start_yr=1991
end_yr=2000
variable='tmax'
data4=imd.get_data(variable, start_yr, end_yr, fn_format="yearwise")
Downloading: maxtemp for year 1991 Downloading: maxtemp for year 1992 Downloading: maxtemp for year 1993 Downloading: maxtemp for year 1994 Downloading: maxtemp for year 1995 Downloading: maxtemp for year 1996 Downloading: maxtemp for year 1997 Downloading: maxtemp for year 1998 Downloading: maxtemp for year 1999 Downloading: maxtemp for year 2000 Download Successful !!!
ds=data4.get_xarray()
ds_time_series = ds.sel(lat=np.arange(18.75,19.25,0.25), lon=np.arange(72.50, 73.00,0.25),method= "nearest")
ds_time_series=ds_time_series['tmax'].mean(dim=('lat','lon'))
ds_time_series.plot(color="purple", aspect = 7, size = 8)
plt.savefig('Series_decade_5_tmax.png', bbox_inches='tight')
start_yr=2001
end_yr=2010
variable='tmax'
data5=imd.get_data(variable, start_yr, end_yr, fn_format="yearwise")
Downloading: maxtemp for year 2001 Downloading: maxtemp for year 2002 Downloading: maxtemp for year 2003 Downloading: maxtemp for year 2004 Downloading: maxtemp for year 2005 Downloading: maxtemp for year 2006 Downloading: maxtemp for year 2007 Downloading: maxtemp for year 2008 Downloading: maxtemp for year 2009 Downloading: maxtemp for year 2010 Download Successful !!!
ds=data5.get_xarray()
ds_time_series = ds.sel(lat=np.arange(18.75,19.25,0.25), lon=np.arange(72.50, 73.00,0.25),method= "nearest")
ds_time_series=ds_time_series['tmax'].mean(dim=('lat','lon'))
ds_time_series.plot(color="purple", aspect = 7, size = 8)
plt.savefig('Series_decade_6_tmax.png', bbox_inches='tight')
start_yr=2011
end_yr=2020
variable='tmax'
data6=imd.get_data(variable, start_yr, end_yr, fn_format="yearwise")
Downloading: maxtemp for year 2011 Downloading: maxtemp for year 2012 Downloading: maxtemp for year 2013 Downloading: maxtemp for year 2014 Downloading: maxtemp for year 2015 Downloading: maxtemp for year 2016 Downloading: maxtemp for year 2017 Downloading: maxtemp for year 2018 Downloading: maxtemp for year 2019 Downloading: maxtemp for year 2020 Download Successful !!!
ds=data6.get_xarray()
ds_time_series = ds.sel(lat=np.arange(18.75,19.25,0.25), lon=np.arange(72.50, 73.00,0.25),method= "nearest")
ds_time_series=ds_time_series['tmax'].mean(dim=('lat','lon'))
ds_time_series.plot(color="purple", aspect = 7, size = 8)
plt.savefig('Series_decade_7_tmax.png', bbox_inches='tight')
start_yr=1951
end_yr=2020
variable='tmax'
data_full=imd.open_data(variable, start_yr, end_yr, fn_format="yearwise")
ds=data_full.get_xarray()
ds_time_series = ds.sel(lat=np.arange(18.75,19.25,0.25), lon=np.arange(72.50, 73.00,0.25),method= "nearest")
ds_time_series=ds_time_series['tmax'].mean(dim=('lat','lon'))
ds_time_series.plot(color="purple", aspect = 5, size = 80)
[<matplotlib.lines.Line2D at 0x20f607052e0>]